import {
  require
} from "../utils/util"

// 登录接口
const login = (data) => require('/admin/login', 'post', data)

// 注册接口
const register = (data) => require('/admin/register', 'post', data)

// 管理员接口
// 获取商品列表接口
const getGoods = (data) => require('/admin/goods/search', 'get', data)

// 获取推荐商品接口
const recommend = (data) => require('/admin/goods/recommend/search', 'get', data)

// 删除商品接口
const delGoods = (data) => require('/admin/goods/delete', 'post', data)

// 获取订单接口
const getExchange = (data) => require('/admin/exchange/search', 'get', data)

// 订单发货接口
const exchange = (data) => require('/admin/exchange/confirm', 'post', data)

// 获取订单详情接口
const exchangeDetails = (data) => require('/admin/exchange/info', 'post', data)

// 更新商品信息
const updateGoods = (data) => require('/admin/goods/update', 'post', data)

// 新增推荐商品
const addRecommend = (data) => require('/admin/goods/recommend/add', 'post', data)

// 获取通知列表
const getNotice = (data) => require('/admin/notice/search', 'get', data)

// 删除通知
const delNotice = (data) => require('/admin/notice/delete', 'post', data)

// 获取赠送积分信息列表
const getCredit = (data) => require('/admin/credit/search', 'get', data)

// 撤销赠送积分信息列表
const getRepeal = (data) => require('/admin/credit/repeal', 'post', data)

// 赠送积分
const addCredit = (data) => require('/admin/credit/send', 'post', data)

// 获取赠送优惠卷信息列表
const getCoupon = (data) => require('/admin/coupon/search', 'get', data)

// 撤销赠送优惠卷信息列表
const repealCoupon = (data) => require('/admin/coupon/repeal', 'post', data)

// 赠送优惠卷
const addCoupon = (data) => require('/admin/coupon/send', 'post', data)

// 获取用户列表
const getUser = (data) => require('/admin/user/search', 'get', data)

// 获取用户选择列表
const getUserSelectList = () => require('/admin/user/select/list', 'get')

// 启用禁用账户
const updateUser = (data) => require('/admin/user/update', 'post', data)

// 上下架商品
const uploadGoods = (data) => require('/admin/goods/upload', 'post', data)

// 移除推荐
const deleteRecommend = (data) => require('/admin/goods/recommend/delete', 'post', data)

// 前台
// 1.首页
// 获取首页商品列表
const shopIndex = (data) => require('/home/shop/index', 'get', data)

// 获取首页推荐商品列表
const shopIndexRecommend = (data) => require('/admin/goods/recommend/search', 'get', data)

// 获取商品详情列表
const shopGoodsInfo = (data) => require('/home/shop/goods/info', 'get', data)

// 新增商品评论
const commentAdd = (data) => require('/home/comment/add', 'post', data)

// 修改商品评论
const commentUpdate = (data) => require('/home/comment/update', 'post', data)

// 删除商品评论
const commentDelete = (data) => require('/home/comment/delete', 'post', data)

// 2.购物车
// 添加购物车
const addCart = (data) => require('/home/cart/add', 'post', data)

// 获取购物车列表
const getCart = (data) => require('/home/cart/list', 'get', data)

// 更新购物车数量
const updateCart = (data) => require('/home/cart/update', 'post', data)

// 获取可用优惠卷
const getCartCoupon = (data) => require('/home/cart/coupon/list', 'post', data)

// 确认兑换
const submitCart = (data) => require('/home/cart/submit', 'post', data)

// 删除购物车商品
const delCart = (data) => require('/home/cart/delete', 'post', data)

// 3.个人中心
// 获取用户信息
const getAbout = (data) => require('/home/about', 'get', data)

// 修改密码
const updatePassword = (data) => require('/home/update/password', 'post', data)

// 修改密码
const updateNick = (data) => require('/home/update', 'post', data)


// 获取每日通知
const getNotices = (data) => require('/home/notice/list', 'get', data)

// 撤销订单
const cancelExchange = (data) => require('/admin/exchange/cancel', 'post', data)


module.exports = {
  login,
  register,
  shopIndex,
  shopIndexRecommend,
  shopGoodsInfo,
  commentAdd,
  commentDelete,
  commentDelete,
  getGoods,
  delGoods,
  getExchange,
  exchange,
  exchangeDetails,
  recommend,
  addRecommend,
  getNotice,
  delNotice,
  getCredit,
  getRepeal,
  addCredit,
  getCoupon,
  repealCoupon,
  addCoupon,
  commentUpdate,
  addCart,
  getCart,
  updateCart,
  getCartCoupon,
  submitCart,
  getAbout,
  delCart,
  updatePassword,
  updateNick,
  getNotices,
  getUser,
  getUserSelectList,
  updateUser,
  uploadGoods,
  updateGoods,
  deleteRecommend,
  cancelExchange
}